<template>
    <div>
        <div class="header_shadow" :style="commonData.indexLogo==1?'background:#fff':'background:#0b67d0'">
            <header class="header" :style="commonData.indexLittleApp==1?'width:1200px':'width:1150px'">
                <div :class="commonData.indexLogo==1?'indexHeader':'userHeader'">
                    <router-link class="logoImg" to="/index">
                        <img v-if="!commonData.indexLogo" :src="procedureConfig.logo1Url">
                        <img v-if="commonData.indexLogo==1" :src="procedureConfig.logo2Url">
                    </router-link>
                    <!-- <div class="littleApp" v-if="commonData.indexLittleApp==1">
                        <span>小程序</span>
                        <div class="littleAppBox">
                            <img src="/static/img/index/littleAppTan.png" width="182px" height="223px">
                            <p class="littleSpan1">扫一扫关注小程序</p>
                            <img class="littleAppImg" src="/static/img/index/littleApp.png" width="160px" height="160px">
                            <p class="littleSpan2">学员个人使用，随时随地学习</p>
                        </div>
                    </div> -->
                    <!-- <div style="display: inline-block;float: right;" v-if="commonData.isShowUserBox==1"></div> -->
                    <div style="display: inline-block;float: right;">
                        <template v-if="!String.isEmptyOrNUll(loginInfo.token)">
                            <a class="f_right commonLoginOut" @click="loginOut">
                                <span class="header_out_img"></span>
                                退出登录</a>
                            <router-link class="f_right commonUser" target="_blank" to="/user_info">欢迎您，{{loginInfo.realName}}
                                <span style="font-size: 15px;margin-left: 10px;">个人中心</span>
                            </router-link>
                        </template>
                        <template v-else>
                            <router-link class="f_right" to="/company_login">
                                <img src="/static/img/index/index_company.png" class="index_header_icon" width="20px"
                                    height="20px" />
                                企业入口</router-link>
                            <router-link class="f_right" style="margin-right: 30px" to="/login">
                                <img src="/static/img/index/index_person.png" class="index_header_icon" width="20px"
                                    height="20px" />
                                学员入口</router-link>
                        </template>
                    </div>
                </div>
            </header>
        </div>
        <slot></slot>
        <footer class="footer text_center"  style="height: 160px;background: #001F3A;line-height: 160px;font-size: 22px;">
            <a target="_blank" href="http://beian.miit.gov.cn">
                <p style="color: #FFFFFF;">@Copy Right 2009-2021 杭州建筑协会咨询培训部 hzxh.xclean.com浙JCP备16015764号-1</p>
                <!-- <img :src="commonData.$parent.procedureConfig.footUrl"> -->
            </a>
        </footer>
    </div>
</template>

<script>
    export default {
        props: ["commonData"],
        data: function() {
            return {
                loginInfo: {
                    token: undefined,
                    realName: undefined
                },
                procedureConfig:{}
            }
        },
        mounted: function() {
            var that=this;
            if (!String.isEmptyOrNUll(this.$cookies.get("loginInfo"))) {
                this.loginInfo = this.$cookies.get("loginInfo");
            }
            this.common.post(this.api.getProcedureConfig, {}, function(res) {
                var res = JSON.parse(res.resultMap);
                that.procedureConfig = res;
            });
        },
        methods: {
            loginOut: function() {
                // this.common.post(this.api.loginOut, {}, function(res) {});
                this.$cookies.remove('loginInfo');
                this.$cookies.remove('token');
                localStorage.clear();
                this.common.toPage("/login");
            },
            loginOutAdmin: function() {
                // this.common.post(this.api.loginOutAdmin, {}, function(res) {});
                this.$cookies.remove('loginInfo');
                this.$cookies.remove('token');
                localStorage.clear();
                this.common.toPage("/company_login");
            },
        }
    }
</script>

<style>
    .header_out_img {
        /* background-image: url(../../static/img/index/out_header_icon_b.png); */
    }
</style>
